/*
 * misc.h
 *
 *  Created on: 03/05/2013
 *      Author: jose
 */

#ifndef MISC_H_
#define MISC_H_

struct string_st
{
	char * text;
	unsigned len;
};
typedef struct string_st DwrString;

DwrString *
dwr_string_create_no_len(const char * str);

DwrString *
dwr_string_create_with_len(const char * str, const unsigned len);

DwrString *
dwr_string_itoa(const int value, const char * format, const unsigned len);

unsigned char *
dwr_char_itoa(const int value, const char * format, const unsigned len);

DwrString *
dwr_string_concat(DwrString * s1, const DwrString * s2);

DwrString *
dwr_string_concat_comma(DwrString * s1, short unsigned * previous,
		const char * s2);

DwrString *
dwr_string_concat_comma_quote(DwrString * s1, short unsigned * previous,
		const char * s2);

unsigned char *
dwr_string_get_text(DwrString * str);

#ifdef DWR_DEBUG
void dwr_log_char(const char *file, const char *func,  const int line,
		const char *description, const char *aux);

void dwr_log_string(const char *file, const char *func,  const int line,
		const char *description, const DwrString *aux);
#endif

#endif /* MISC_H_ */
